﻿using System.Diagnostics.Contracts;

namespace MathService.NeuralNetworks
{
    public class NeuralInput : INeuralInput
    {
        private INeuron f_Neuron;

        public INeuron Neuron
        {
            get { return f_Neuron; }
            set
            {
                Contract.Requires(value != null, @"Нейрон не может отсутствовать");
                Contract.Ensures(f_Neuron != null);
                f_Neuron = value;
            }
        }

        public double Value { get { return f_Neuron.Value; } }

        public double Weight { get; set; }

        public double WeightValue { get { return Weight * Value; } }

        public NeuralInput(INeuron Neuron)
        {
            Contract.Requires(Neuron != null, @"Нейрон не может отсутствовать");
            Contract.Ensures(f_Neuron != null);
            f_Neuron = Neuron;
        }

    }
}